//
//  TaskMeVCCell.m
//  ZITHER
//
//  Created by 吴凡 on 2019/2/27.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "TaskMeVCCell.h"
#import "MyQRCodeWebVC.h"

@implementation TaskMeVCCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.contentView addSubview:self.pushWebBtn];
    [self.contentView addSubview:self.taskImageView];
    [self.pushWebBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top);
        make.centerX.equalTo(self.contentView);
        make.size.mas_equalTo(CGSizeMake(30, 30));
    }];
    [self.taskImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(127, 20));
        make.top.equalTo(self.pushWebBtn.mas_bottom).offset(6);
        make.centerX.equalTo(self.contentView);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(-43);
    }];
}

- (UIButton *)pushWebBtn{
    if (!_pushWebBtn) {
        _pushWebBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_pushWebBtn setImage:[UIImage imageNamed:@"活动_分享"] forState:UIControlStateNormal];
        [_pushWebBtn addTarget:self action:@selector(pushWebAction:) forControlEvents:UIControlEventTouchUpInside];
        _pushWebBtn.layer.masksToBounds = YES;
        _pushWebBtn.layer.cornerRadius = 15.f;
    }
    return _pushWebBtn;
}
- (UIImageView *)taskImageView {
    if (!_taskImageView) {
        _taskImageView = [UIImageView new];
        if ([Main_Token_Model_MANAGER.isToken isEqualToString:@"0"]) {
            _taskImageView.image = [UIImage imageNamed:@"我的_ 邀请好友 最高10元位"];
        }
    }
    return _taskImageView;
}
- (void)pushWebAction:(id)sender {
    MyQRCodeWebVC * vc = [[MyQRCodeWebVC alloc]init];
    vc.navStyle = 2;
    [self.getNav pushViewController:vc animated:YES];
    vc.url = [NSString stringWithFormat:@"%@/#/activity/bonus/",RootUrlWeb];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
